Efficient computation of strictness types∗
نویسنده
چکیده
Amtoft has formulated an “on-line” constraint normalization method for solving a strictness inference problem inspired by Wright. From the syntactic form of the normalized constraints he establishes that every program expression has a unique, most precise (“minimal”) strictness judgement, given fixed values for the strictness annotation in negative position. We show that his on-line normalization is not required for proving his main syntactic result. Instead of normalizing the constraints during a bottom-up pass through the program we simply collect them first and solve them by standard iterative fixed point methods in a second phase. The main result follows from the fact that observable negative strictness variables only occur on the right-hand sides of the constraints. Furthermore, a standard iterative fixed point algorithm solves the constraints in linear time in the number of strictness variables in the constraint system whereas Amtoft’s method requires exponential time. Our presentation is somewhat different than Amtoft’s. We use a linear-logic inspired presentation of the programming language and the strictness inference system for it. This results in smaller constraint systems generated. A tight strictness inference normalization result shows that many inequational constraints can be replaced by equational ones. Thus the constraint system can be simplified and significantly reduced in size by efficient variable unification, which can be performed on-line during its construction. Finally, we give an asymptotic worst-case analysis of the size of constraint systems relative to a program with or without explicitly typed variable declarations. Generally, our method provides insight into the strengths of noncompositional program analysis methods; i.e., methods where the solution for a program is not computed as a function of the corresponding solutions of its immediate components, such as in Algorithm W or in frontier-based abstract interpretation. More specifically, our method demonstrates the effective use of efficient iterative fixed point computation known from classical data flow analysis in type-based program analysis.
منابع مشابه
Type Inference, Abstract Interpretation and Strictness Analysis
Coppo, M. and A. Ferrari, Type inference, abstract interpretation and strictness analysis, Theoretical Computer Science 121 (1993) 113-143. Filter domains (Coppo et al., 1984) can be seen as abstract domains for the interpretation of (functional) type-free programming languages. What is remarkable is the fact that in filter domains the interpretation of a term is given by the set of its types i...
متن کاملOn Strictness and Totality
Abs t rac t . In this paper we present a revised and extended version of the strictness and totality type assignment system introduced by Solberg, Nielson and Nielson in the Static Analysis Symposium '9~. Our main result is that (w.r.t. the possibility of replacing safely a lazy application by a strict one) the strictness and totality information given by this system is equivalent to the inform...
متن کاملIterative Fixed Point Computation for Type-Based Strictness Analysis
Amtoft has formulated an “on-line” constraint normalization method for solving a strictness inference problem inspired by Wright. From the syntactic form of the normalized constraints he establishes that every program expression has a unique, most precise (“minimal”) strictness judgement, given fixed values for the strictness annotation in negative position. We show that his on-line normalizati...
متن کاملStrictness Analysis via Resource Typing
We present a new typing system for strictness analysis of functional programs. The system extends standard typing (including recursive data types) with strictness annotations and subtyping. Strictness typing is shown to be sound with respect to a natural operational semantics. We demonstrate that strictness types can be computed effectively.
متن کاملStrictness Types: An Inference Algorithm and an Application
This report deals with strictness types, a way of recording whether a function needs its argument(s) or not. We shall present an inference system for assigning strictness types to expressions and subsequently we transform this system into an algorithm capable of annotating expressions with strictness types. We give an example of a transformation which can be optimized by means of these annotati...
متن کامل